<template>
	<view class="form-container">
		<!-- form演示 -->
		<view class="form-group">
			<form class="form-main">
				<view class="form-group">
					<h3>托盘码</h3>
					<view>
						<input id="user-insert-line" :focus="focus1" name="input" v-model="model.traycode"
							placeholder="托盘码" />
					</view>
				</view>
				<!-- 新增button按钮触发submit事件 -->
				<view class="form-group"><button class="btnsubmit" @click="deterMine" form-type="submit">确定</button>
				</view>
				<view class="form-group"><button type="default" @click="clear" form-type="reset">重置</button></view>
			</form>
		</view>
	</view>
</template>

<script>
	import comboxSearch from "@/components/cuihai-combox/cuihai-combox.vue"
	import uniSection from "@/components/uni-section.vue"
	export default {
		components: {
			comboxSearch,
			uniSection
		},
		data() {
			return {
				candidates: null,
				productionInfo: null,
				model: {
					traycode: ''
				},
				focus1: true,
				keyNameCode: 'devCode',
				keyName: 'materialType',
			}
		},
		onLoad() {
			this.screenHeight = uni.getSystemInfoSync().windowHeight;
		},
		methods: {
			deterMine() {
				const that = this
				uni.showModal({
					title: '提示',
					content: '确定查询次托盘状态吗?',
					success: function(res) {
						if (res.confirm) {
							uni.request({
								/* 网页 调试接口 */
								//url: '/api/PDA/CallMaterial',
								//url: 'http://10.5.64.102:5000/PDA/CallMaterial',
								url: that.$global.url2 +
									':8090/apis/Acc/ProductProcess/TrayStatus?trayCode=' + that.model
									.traycode,
								method: 'GET',
								sslVerify: false,
								header: {
									"Content-Type": "application/json; charset=UTF-8"
								},
								success: (res) => {
									if (res.statusCode == 200 && res.data.ret == 1) {
										uni.showToast({
											icon: 'success',
											title: res.data.data.trayResultDesc,
											mask: true,
										});
										console.log(res)
									} else {
										uni.showToast({
											icon: 'error',
											mask: true,
											title: '报废失败！11',
										});
										console.log('1231313' + this.model.traycode)
										console.log(this.url.url)
									}
								},
								fail: (res) => {
									uni.showToast({
										icon: 'error',
										mask: true,
										title: "接口请求失败!",
									})
									console.log("error===" + res.errMsg)
								}
							})
						} else if (res.cancel) {
							return
						}
					}
				})
			},
			clear() {
				this.productionInfo = null
			},
		}
	}
</script>
<style lang="scss">
	page {
		background-color: #EEF0F4;
		font-size: 18px;
	}

	u-button {
		float: left;
		display: inline;
	}

	.form {
		margin-top: 35rpx;
		width: 100%;
		padding: 0 20rpx;
	}

	.form-group {

		padding: 20rpx 30rpx 0rpx 30rpx;
	}

	.btnsubmit {
		margin-top: 50px;
	}

	#user-insert-line::before {
		position: absolute;
		right: 25px;
		bottom: 0;
		top: 5rem;
		left: 40px;
		height: 1px;
		content: '';
		-webkit-transform: scaleY(.5);
		transform: scaleY(.5);
		background-color: #c8c7cc;
	}

	#name::before {
		position: absolute;
		right: 25px;
		bottom: 0;
		top: 8.8rem;
		left: 40px;
		height: 1px;
		content: '';
		-webkit-transform: scaleY(.5);
		transform: scaleY(.5);
		background-color: #c8c7cc;
	}
</style>
